package com.itheima.dao;

import com.itheima.pojo.Permission;
import com.itheima.pojo.Role;
import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SpringSecurityUserDao {
    //@Select("select * from t_user where username=#{username}")
    @Select("select * from t_user where username=#{username} and station = '1' ")
    public User getByUsername(String username);

    @Select("select * from t_role where id in (select role_id from t_user_role where user_id=#{userId})")
    public List<Role>  getByUserId(Integer userId);

    @Select("select * from t_permission where id in (select permission_id from t_role_permission where role_id=#{roleId})")
    public List<Permission>  getByRoleId(Integer roleId);

}
